<?php

/**
 * @author Martin Pernica
 * @copyright 2008
 */
 echo '<br /><h2><a href="index.php?p=build">Zpět</a></h2><br />';
if(!empty($_POST['title']) && !empty($_POST['href'])){
	$query = $GLOBALS['db']->query("UPDATE ".$GLOBALS['db_prefix']."menu SET title = '".$_POST['title']."', href = '".$_POST['href']."', position = '".$_POST['position']."', weigh = '".intval($_POST['weigh'])."' WHERE id = '".intval($_GET['id'])."'");
	echo '<h2>Položka byla upravena !</h2>';
}
$data = $GLOBALS['db']->query("SELECT * FROM ".$GLOBALS['db_prefix']."menu WHERE id = '".intval($_GET['id'])."'");
$data = $data->fetch_array();
$position = array('Vlevo' => 'left', 'Vpravo' => 'right', 'Nahoře' => 'top');
echo '
<form action="'.$_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING'] .'" method="POST">
<table>
<tr><td>Název :</td><td><input type="text" name="title" size="25" value="'.$data['title'].'" /></td></tr>
<tr><td>Odkaz :</td><td><input type="text" name="href" size="25" value="'.$data['href'].'" /></td></tr>
<tr><td>Pozice :</td><td>
<select name="position" size="3">';
foreach ($position as $key => $val){
		$selected = ($data['position'] == $val) ? 'selected' : '';
	echo '<option value="'.$val.'" '.$selected.'>'.$key.'</option>';
}
echo '
</select>
</td></tr>
<tr><td>Váha :</td><td><input type="text" name="weigh" size="25" value="'.intval($data['weigh']).'" /></td></tr>
<tr><td><input type="submit" value="Odeslat" /></td></tr>
</table>
</form>
<p>Nápověda: Odkaz na komponentu se skládá index.php?q=[název_komponenty] + její možné podčásti.</p>
<p>Například: index.php?q=custom/1-vitejte</p>';
?>